package com.erli.exchange.common.sg;

import java.util.ArrayList;
import java.util.List;

/**
 * 源码生成器
 * 
 * @title SourceGenerater.java
 * @package com.example.demo.sourcegenerate
 * @author lihu
 * @update 2019年2月19日 下午3:50:38
 */
public class Main {

	private EntitySourceGenerater entitySourceGenerator = new EntitySourceGenerater();
	private ModelSourceGenerator modelSourceGenerator = new ModelSourceGenerator();
	private ConverterSourceGenerator converterSourceGenerator = new ConverterSourceGenerator();
	private ServiceSourceGenerator serviceSourceGenerator = new ServiceSourceGenerator();
	private ServiceImplSourceGenerator serviceImplSourceGenerator = new ServiceImplSourceGenerator();
	private DaoSourceGenerator daoSourceGenerator = new DaoSourceGenerator();
	private DaoImplSourceGenerator daoImplSourceGenerator = new DaoImplSourceGenerator();
	private MapperSourceGenerator mapperSourceGenerator = new MapperSourceGenerator();
	private MapperXmlGenerator mapperXmlGenerator = new MapperXmlGenerator();


	private List<AbstractSourceGenerator> sourceGeneratorList = new ArrayList<AbstractSourceGenerator>();

	{
		sourceGeneratorList.add(entitySourceGenerator);
		sourceGeneratorList.add(modelSourceGenerator);
		sourceGeneratorList.add(converterSourceGenerator);
//		sourceGeneratorList.add(serviceSourceGenerator);
//		sourceGeneratorList.add(serviceImplSourceGenerator);
//		sourceGeneratorList.add(daoSourceGenerator);
//		sourceGeneratorList.add(daoImplSourceGenerator);
//		sourceGeneratorList.add(mapperSourceGenerator);
//		sourceGeneratorList.add(mapperXmlGenerator);
	}

	private void generateSourceFile() {
		try {
			for (AbstractSourceGenerator sourceGenerator : sourceGeneratorList) {
				sourceGenerator.generateAllSourceFile();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) throws Exception {
		Main main = new Main();
		main.generateSourceFile();
	}

}
